/**
 */
package OBSL.impl;

import OBSL.OBSLPackage;
import OBSL.PhasePartitionRuleset;

import RefOntoUML.Classifier;
import RefOntoUML.GeneralizationSet;
import RefOntoUML.Phase;
import RefOntoUML.SortalClass;

import java.lang.reflect.InvocationTargetException;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.WrappedException;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EOperation;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Phase Partition Ruleset</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link OBSL.impl.PhasePartitionRulesetImpl#getPartition <em>Partition</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class PhasePartitionRulesetImpl extends RulesetImpl implements PhasePartitionRuleset {
	/**
	 * The cached value of the '{@link #getPartition() <em>Partition</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPartition()
	 * @generated
	 * @ordered
	 */
	protected GeneralizationSet partition;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected PhasePartitionRulesetImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return OBSLPackage.Literals.PHASE_PARTITION_RULESET;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public GeneralizationSet getPartition() {
		if (partition != null && partition.eIsProxy()) {
			InternalEObject oldPartition = (InternalEObject)partition;
			partition = (GeneralizationSet)eResolveProxy(oldPartition);
			if (partition != oldPartition) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, OBSLPackage.PHASE_PARTITION_RULESET__PARTITION, oldPartition, partition));
			}
		}
		return partition;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public GeneralizationSet basicGetPartition() {
		return partition;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setPartition(GeneralizationSet newPartition) {
		GeneralizationSet oldPartition = partition;
		partition = newPartition;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, OBSLPackage.PHASE_PARTITION_RULESET__PARTITION, oldPartition, partition));
	}

	/**
	 * The cached invocation delegate for the '{@link #classifiedBy() <em>Classified By</em>}' operation.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #classifiedBy()
	 * @generated
	 * @ordered
	 */
	protected static final EOperation.Internal.InvocationDelegate CLASSIFIED_BY__EINVOCATION_DELEGATE = ((EOperation.Internal)OBSLPackage.Literals.PHASE_PARTITION_RULESET___CLASSIFIED_BY).getInvocationDelegate();

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Classifier classifiedBy() {
		try {
			return (Classifier)CLASSIFIED_BY__EINVOCATION_DELEGATE.dynamicInvoke(this, null);
		}
		catch (InvocationTargetException ite) {
			throw new WrappedException(ite);
		}
	}

	/**
	 * The cached invocation delegate for the '{@link #bearer() <em>Bearer</em>}' operation.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #bearer()
	 * @generated
	 * @ordered
	 */
	protected static final EOperation.Internal.InvocationDelegate BEARER__EINVOCATION_DELEGATE = ((EOperation.Internal)OBSLPackage.Literals.PHASE_PARTITION_RULESET___BEARER).getInvocationDelegate();

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SortalClass bearer() {
		try {
			return (SortalClass)BEARER__EINVOCATION_DELEGATE.dynamicInvoke(this, null);
		}
		catch (InvocationTargetException ite) {
			throw new WrappedException(ite);
		}
	}

	/**
	 * The cached invocation delegate for the '{@link #phases() <em>Phases</em>}' operation.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #phases()
	 * @generated
	 * @ordered
	 */
	protected static final EOperation.Internal.InvocationDelegate PHASES__EINVOCATION_DELEGATE = ((EOperation.Internal)OBSLPackage.Literals.PHASE_PARTITION_RULESET___PHASES).getInvocationDelegate();

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	public EList<Phase> phases() {
		try {
			return (EList<Phase>)PHASES__EINVOCATION_DELEGATE.dynamicInvoke(this, null);
		}
		catch (InvocationTargetException ite) {
			throw new WrappedException(ite);
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case OBSLPackage.PHASE_PARTITION_RULESET__PARTITION:
				if (resolve) return getPartition();
				return basicGetPartition();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case OBSLPackage.PHASE_PARTITION_RULESET__PARTITION:
				setPartition((GeneralizationSet)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case OBSLPackage.PHASE_PARTITION_RULESET__PARTITION:
				setPartition((GeneralizationSet)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case OBSLPackage.PHASE_PARTITION_RULESET__PARTITION:
				return partition != null;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException {
		switch (operationID) {
			case OBSLPackage.PHASE_PARTITION_RULESET___CLASSIFIED_BY:
				return classifiedBy();
			case OBSLPackage.PHASE_PARTITION_RULESET___BEARER:
				return bearer();
			case OBSLPackage.PHASE_PARTITION_RULESET___PHASES:
				return phases();
		}
		return super.eInvoke(operationID, arguments);
	}

} //PhasePartitionRulesetImpl
